using System;
using System.Collections;

namespace PSM
{
    public class Common : IState
    {
        public Common() : base(StateID.SID_Common)
        {

        }

        ~Common()
        {

        }

        public override EvRet onEvent(IEvent ev)
        {
            StateID sid = m_id;
            switch (ev.m_type)
            {
            case EventType.EVT_Sys_ChangeState:
                {
                    EventSysChangeState changeEv = (EventSysChangeState)(ev);
                    changeEv.exec(this);
                }
                break;
            case EventType.EVT_InitGoTo:
                {
                    getOwnerChain().enter(StateID.SID_GoTo, Misc.getPri4State(StateID.SID_GoTo), ev);
                }
                break;
            case EventType.EVT_InitNormalAttack:
                {
                    getOwnerChain().enter(StateID.SID_NormalAttack, Misc.getPri4State(StateID.SID_NormalAttack), ev);
                }
                break;
            case EventType.EVT_InitRun:
                {
                    getOwnerChain().enter(StateID.SID_Run);
                }
                break;
            case EventType.EVT_InitHit:
                {
                    getOwnerChain().enter(StateID.SID_Hit);
                }
                break;
            case EventType.EVT_InitLineup:
                {
                    getOwnerChain().enter(StateID.SID_Lineup, Misc.getPri4State(StateID.SID_Lineup), ev);
                }
                break;
            case EventType.EVT_InitPursuit:
                {
                    getOwnerChain().enter(StateID.SID_Pursuit, Misc.getPri4State(StateID.SID_Pursuit), ev);
                }
                break;
            case EventType.EVT_InitBattle:
                {
                    getOwnerChain().enter(StateID.SID_Battle, Misc.getPri4State(StateID.SID_Battle), ev);
                }
                break;
            }

            return EvRet.EVR_NULL;
        }
    }
}

